﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace xyjc
{
	class Program
    {
        static void Main(string[] args)
        {
            test2();
            Console.ReadKey();
        }

        static void test2()
        {
            AppConfig config = new AppConfig();
            config.SetDatabaseConnection(@"PC-201609241923\AMULIANG", "xyjc", "sa", "123456");
            config.SetTemplateFile(@"Template/template2.docx");
            config.SetListenPath("Listen/");
            config.SetOutputPath("Output/");
            config.SetFileSavePath("pic/");
            App app = new App(config);

            app.TransWord(@"Listen2/test2.docx");

            //app.StartListen();
            Console.WriteLine("完成");
        }

        static void test3()
        {
            var values = new string[]{ "30", "20", "10", "20", "40", "50", "60", "70", "80", "90", "100", "20", "10", "20", "10" };

            Image imgTemp = new Bitmap("risk.png");
            Graphics g = Graphics.FromImage(imgTemp);

            List<SolidBrush> levels = new List<SolidBrush>();
            levels.Add(new SolidBrush(Color.FromArgb(143, 195, 31)));
            levels.Add(new SolidBrush(Color.FromArgb(0, 162, 154)));
            levels.Add(new SolidBrush(Color.FromArgb(243, 152, 0)));
            levels.Add(new SolidBrush(Color.FromArgb(195, 13, 35)));
            levels.Add(new SolidBrush(Color.FromArgb(96, 25, 134)));
            levels.Add(new SolidBrush(Color.FromArgb(96, 25, 134)));

            for (int i = 0; i < values.Length; i++)
            {
                int temp = int.Parse(values[i]);
                int level = (int)(temp / 20);
                int x = 12 + i * 33;
                int height = (int)(205 * temp / 100);
                int y = 245 - height;
                int width = 16;
                g.FillRectangle(levels[level], x, y, width, height);
            }

            imgTemp.Save("aa.jpg");
            g.Dispose();
        }

        static void test4()
        {
        }
    }
}
